//
// Created by 沈昊 on 2021/12/6.
//
#include <json/json.h>
#include <iostream>
using namespace std;
int main(){
    Json::Value root;
    Json::StreamWriterBuilder builder;
    root["name"] = "shenhao";
    root["id"] = 123;
    root["password"] = 456;
    std::string str = writeString(builder, root);
    cout << str << endl;



    Json::CharReaderBuilder reader_builder;
    Json::CharReader* reader = reader_builder.newCharReader();
    Json::Value val;
    std::string err;
    if(!reader->parse(str.data(), str.data() + str.size(), &val, &err)){
        exit(-1);
    }





    delete reader;
    return 0;
}